<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>农污处理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/admin.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/images/favicon.ico" />
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <button class="layui-btn"  onclick="backup()">备份</button>
            </div>
        </div>
        <div class="layui-card-body">
            <table id="backupList" lay-filter="backupLists"></table>
        </div>
    </div>
</div>
<script type="text/html" id="recovery">
    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="recovery">恢复</a>
</script>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.js"></script>
<script src="<%=request.getContextPath()%>/huazhi/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="<%=request.getContextPath()%>/huazhi/lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
<script>
    layui.use(['backupList'], function(){

    });
   function  backup(){
       layui.layer.confirm('是否确定备份数据？',{icon:3, title:'提示信息'}, function(index) {
           var index = layui.layer.msg('数据备份中，请稍候',{icon: 16,time:false,shade:0.8});
           setTimeout(function(){
               //执行 Ajax 后重载
               //向服务器发送东西
               $.ajax({
                   type: "post",
                   url: "<%=request.getContextPath()%>/rest/system/backups",
                   dataType: "json",
                   async: false,
                   success: function (data) {
                       layui.layer.close(index);
                       if(data != "error"){
                           layui.layer.msg('备份成功');
                           layui.table.reload('backupList')
                       }else {
                           layui.layer.msg('备份失败');
                       }
                   }
               })
           },2000);
       });
    }


</script>
</body>
</html>